package com.ydl.shopping.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydl.shopping.core.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/** 购物车表 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("tb_shopping_cart")
@Schema(name = "购物车表")
public class TbShoppingCart extends BaseEntity {
    /** 用户编号 */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableField("user_id")
    @Schema(description = "用户编号")
    private Long userId;

    /** 商品编号 */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableField("goods_id")
    @Schema(description = "商品编号")
    private Long goodsId;

    /** 下单数量 */
    @TableField("quantity")
    @Schema(description = "下单数量")
    private Integer quantity;

    @TableField(exist = false)
    @Schema(description = "商品名称")
    private String goodsName;

    @TableField(exist = false)
    @Schema(description = "商品单价")
    private BigDecimal goodsUnitPrice;

    @TableField(exist = false)
    @Schema(description = "是否上架")
    private Integer isUp;

    public TbShoppingCart(Long userId, Long goodsId, Integer quantity) {
        this.userId = userId;
        this.goodsId = goodsId;
        this.quantity = quantity;
    }

    public TbShoppingCart() {
    }
}
